#include "gLinkedList.h"
#include "UnitTest++.h"

TEST(TestFindAElementThatExist)
{
    GLinkedList<int>* str = new GLinkedList<int > ();
    str->add(4);
    str->add(3);
    str->add(7);

    CHECK_EQUAL(str->find(3), 3);
}

TEST(TestFindAElementThatDoesNotExist)
{
    GLinkedList<int>* str = new GLinkedList<int > ();
    str->add(4);
    str->add(3);
    str->add(7);
    try
    {
        str->find(11);
        CHECK(false);
    } catch(...)
    {
        
    }
}

TEST(TestFindAElementInEmptyList)
{
    try
    {
        GLinkedList<int>* str = new GLinkedList<int > ();
        str->find(11);
        CHECK(false);
    } catch (...){}
}

TEST(TestAddSort)
{
    GLinkedList<int>* str = new GLinkedList<int> ();
    str->addSort(2);
    str->addSort(5);
    str->addSort(4);
    str->addSort(1);
    int sorted [] = {1, 2, 4, 5};
    
    for(int i = 0; i < str->size(); i++)
    {
        CHECK_EQUAL(sorted[i], str->get(i));
    }
}